#ifndef SERIALIZER_H_
#define SERIALIZER_H_
#include "config.h"
#include <mysql++/mysql++.h>
#include <string>
#include <vector>
#include <sstream>
using namespace std;
using namespace mysqlpp;
namespace Serializer {
	class SerializeRow {
	public:
		SerializeRow(char *buf, unsigned long offset, unsigned long size, unsigned int colstart = 0) {
			this->buf = buf;
			this->colstart = colstart;
			this->max_size = size;
			this->size = 0;
			this->offset = offset;
			this->skipped = 0;
		}
		void operator()(const Row& row);
	private:
		char *buf;
		unsigned int colstart;
		unsigned long max_size, size, offset, skipped;


	};
	//static void SerializeRow(const Row& row, ostringstream& oss, unsigned int colstart = 0);
	size_t RowSize(const Row& row, unsigned int colstart = 0);
	size_t RowSize(const vector<string>& row, unsigned int colstart = 0);
	//static void SerializeResult(const StoreQueryResult& res, ostringstream& oss, unsigned int colstart = 0);
};
#endif //SERIALIZER_H_
